export * from './login'

import request from '@/utils/request.js'
const planUrl = '/api/ziguang-mes-plan'
const basicUrl = '/api/ziguang-mes-basic'

/**
 * 导出
 * @param {*} params 
 */
export function fileDownLoad(params) {
  return request({
    url: `${planUrl}/api/v1/mes/plan/importAndExport/export`,
    method: 'GET',
    responseType: 'blob',
    params,
    timeout: 60000
  })
}

/**
 * 导入
 * @param {*} data 
 * @param {*} params 
 */
export function fileUpLoad(data, params) {
  return request({
    url: `${planUrl}/api/v1/mes/plan/importAndExport/import`,
    method: 'POST',
    params,
    data,
    timeout: 60000
  })
}

// 获取表格表头信息
export function requestTableHeader(moduleName, tableName, factoryId) {
  return request({
    url: `${basicUrl}/api/v1/mes/basic/module/${moduleName}/${tableName}?factoryId=${factoryId}`,
    method: 'GET'
  })
}

// 提交修改表头数据
export function putModifyHeader(data) {
  return request({
    url: `${basicUrl}/api/v1/mes/basic/module/table`,
    method: 'PUT',
    data
  })
}

// 获取工作日历信息
export function requestCalendarWithShift(objectType, objectId, startDate, endDate) {
  return request({
    url: `${basicUrl}/api/v1/mes/basic/${objectType}/${objectId}/shiftInfo?startDate=${startDate}&endDate=${endDate}`,
    method: 'GET'
  })
}